﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MathGraphics
{
    public struct Circle
    {
        public float Radius { get; set; }
        public PointF Center { get; set; }

        public float X
        {
            get
            {
                return Center.X;
            }
            set
            {
                Center = new PointF(value, Center.Y);
            }
        }

        public float Y
        {
            get
            {
                return Center.Y;
            }
            set
            {
                Center = new PointF(Center.X, value);
            }
        }

        public double Area
        {
            get
            {
                return Radius * Radius * Math.PI;
            }
        }

        public Circle(PointF center, float radius)
        {
            Radius = radius;
            Center = center;
        }

        public void Offset(SizeF size)
        {
            X += size.Width;
            Y += size.Height;
        }
        
        public void Inflate(float value)
        {
            float r = value;
            r += value;
            if (r < 0)
            {
                throw new ArgumentException("Radius is less than 0");
            }
            Radius = r;
        }

        public override string ToString()
        {
            return string.Format("{Center = {0} , Radius = {1}}", Center, Radius);
        }
    }
}
